<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::auth();

//index
Route::get('/', ['as' => 'index', 'uses' => 'HomeController@index']);
Route::get('/index', ['as' => 'index', 'uses' => 'HomeController@index']);
Route::get('/home', ['as' => 'index', 'uses' => 'HomeController@index']);


//HomeController
Route::get('/getperm', 'HomeController@getUserPerm');
Route::get('/getarticles', 'HomeController@getArticles');
Route::get('article/article', ['as' => 'article.article', 'uses' => 'HomeController@getArticle']);


//Article
Route::group(['prefix' => 'article', 'middleware' => 'web'], function(){
	Route::get('create',['as' => 'article.create', 'uses' => 'ArticleController@create']);
	Route::post('insert',['as' => 'article.insert', 'uses' => 'ArticleController@insert']);
	Route::post('update',['as' => 'article.update', 'uses' => 'ArticleController@update']);
	Route::get('edit',['as' => 'article.edit', 'uses' => 'ArticleController@edit']);
	Route::post('comments',['as' => 'article.comments', 'uses' => 'ArticleController@comments']);
});

//User
Route::group(['prefix' => 'user', 'middleware' => 'web'], function(){
	Route::get('user',['as' => 'user.user', 'uses' => 'UserController@show']);
	Route::get('edit',['as' => 'user.edit', 'uses' => 'UserController@edit']);
	Route::post('update',['as' => 'user.update', 'uses' => 'UserController@update']);
	Route::post('uploadimage',['as' => 'user.upload', 'uses' => 'UserController@uploadimage']);
});
Route::get('user/home',['as' => 'user.home', 'uses' => 'UserController@userHome']);


//Admin
Route::group(['prefix' => 'admin', 'middleware' => 'admin'],function(){
	Route::get('home',['as' => 'admin.home', 'uses' => 'AdminController@index']);
	Route::get('logout', ['as' => 'admin.logout', 'uses' => 'Auth\adminAuthController@logout']);

	//Clubs
	Route::get('clubs/list', ['as' => 'clubs.list', 'uses' => 'ClubController@listshow']);
	Route::get('clubs/create', ['as' => 'clubs.create', 'uses' => 'ClubController@create']);
	Route::post('clubs/create', ['as' => 'clubs.insert', 'uses' => 'ClubController@insert']);
	Route::get('clubs/edit', ['as' => 'clubs.edit', 'uses' => 'ClubController@edit']);
	Route::post('clubs/update', ['as' => 'clubs.update', 'uses' => 'ClubController@update']);
	Route::get('clubs/delete', ['as' => 'clubs.delete', 'uses' => 'ClubController@delete']);

	//Users
	Route::get('user/list', ['as' => 'usermanage.list', 'uses' => 'AdminController@userList']);
	Route::get('user/delete', ['as' => 'usermanage.delete', 'uses' => 'AdminController@userDelete']);

	//WebConfig
	Route::get('webconfig', ['as' => 'webconfig', 'uses' => 'AdminController@webConfig']);
	Route::post('webconfig', ['as' => 'editwebconfig', 'uses' => 'AdminController@editWebConfig']);

	//Articles
	Route::get('articles/list', ['as' => 'articlemanage.list', 'uses' => 'AdminController@articleList']);
	Route::get('articles/delete', ['as' => 'articlemanage.delete', 'uses' => 'AdminController@articleDelete']);
});
Route::get('admin/login', ['uses' => 'Auth\adminAuthController@getLogin']);
Route::post('admin/login', ['uses' => 'Auth\adminAuthController@postLogin']);
Route::get('admin/register', ['uses' => 'Auth\adminAuthController@getRegister']);
Route::post('admin/register', ['uses' => 'Auth\adminAuthController@postRegister']);
